package com.garen.sys.dao.impl;

import com.garen.sys.dao.IFireMenuDao;
import com.garen.sys.entity.FireMenu;
import com.garen.utils.MapBuilder;
import com.garen.common.BaseDao;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

import javax.annotation.PostConstruct;


@Repository
public class FireMenuDaoImpl extends BaseDao<FireMenu> implements IFireMenuDao {

	@PostConstruct
	private void init(){
		initOrm(FireMenu.class);
	}


	@Override
	public List<FireMenu> queryMenuByRoleId(Integer roleId) {
		String sql = "select  t1.* from fire_menu t1,fire_role_menu t2 "
					+ "where t1.menu_id = t2.menu_id and t2.role_id = :roleId order by t1.order_num asc ";		
		Map<String,Object> paramMap = new MapBuilder()
				.put("roleId", roleId)
				.build();
		return getListBySQL(sql, paramMap);
	}

	
}
